package org.tea.inventory.base.response;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * REST API 返回结果
 * </p>
 *
 * @author gourd.hu
 * @since 2018-11-08
 */
@Data
public class BaseResponse<T> implements Serializable {

    @ApiModelProperty("响应码")
    private Integer errno;

    @ApiModelProperty("响应消息")
    private String errmsg;

    @ApiModelProperty("响应数据")
    private T data;

    @ApiModelProperty("错误信息集合")
    private List<String> errors;

    public BaseResponse() {
    }

    public BaseResponse(Integer errno, String errmsg) {
        this.errno = errno;
        this.errmsg = errmsg;
    }

    public BaseResponse(Integer errno, String errmsg, T data) {
        this.errno = errno;
        this.errmsg = errmsg;
        this.data = data;
    }

    public BaseResponse(Integer errno, String errmsg, List<String> errors) {
        this.errno = errno;
        this.errmsg = errmsg;
        this.errors = errors;
    }
}